# Contributor: Daniele Debernardi <drebrez@gmail.com>
# Maintainer: Daniele Debernardi <drebrez@gmail.com>
pkgname=apk-file
pkgver=0.3.6
pkgrel=1
pkgdesc="Command line front end for pkgs.alpinelinux.org"
url="https://github.com/genuinetools/apk-file"
arch="all"
license="MIT"
makedepends="go bash"
source="$pkgname-$pkgver.tar.gz::https://github.com/genuinetools/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/go/src/github.com/genuinetools/$pkgname"

# Fails with a permission denied error on some builders without this.
export GO111MODULE=off

prepare() {
	mkdir -p "$srcdir/go/src/github.com/genuinetools"
	mv "$srcdir/$pkgname-$pkgver" "$builddir"
}

build() {
	export GOPATH="$srcdir/go"
	cd "$builddir"
	make
}

check() {
	export GOPATH="$srcdir/go"
	cd "$builddir"
	make test
}

package() {
	install -Dm755 "$builddir/apk-file" \
		"$pkgdir/usr/bin/apk-file"
}

sha512sums="8da3f693ce85e1ab8a9cefb8b5baf83e096770703e5ccda89ec05161e8b4db54a973e54540e5f1737ce6d22cc5cdca10ab22553182de0c1c3cf824fe34d43318  apk-file-0.3.6.tar.gz"
